#include "mp3file.h"

Mp3File::Mp3File(QString name, const QUrl& url, bool downloaded, int host):
        _name(name),
        _url(url),
        _downloaded(downloaded),
        _host(host)
{
}

Mp3File::Mp3File(const QStandardItem& item):
        _name(item.data(nameRole).toString()),
        _url(QUrl(item.data(urlRole).toString())),
        _downloaded(item.data(downloadedRole).toBool()),
        _host(item.data(hostingTypeRole).toInt())
{
}

QStandardItem* Mp3File::toQStandardItem() const
{
    QStandardItem* item = new QStandardItem();

    item->setData(_name,nameRole);
    item->setData(_url.toString(),urlRole);
    item->setData(_downloaded,downloadedRole);
    item->setData(_host,hostingTypeRole);

    return item;
}

